using System;
using System.Globalization;
using System.Threading;

namespace InfoJetSoft.Service.Util
{
	class SimpleDateFormat
	{
		private string dateTimeFormat = null;
		private DateTimeFormatInfo dateTimeFormatInfo = null;

		public SimpleDateFormat( string format , CultureInfo locale )
		{
			this.dateTimeFormat = format; 
			this.dateTimeFormatInfo = locale.DateTimeFormat;
		}

		public SimpleDateFormat( string format ){
			this.dateTimeFormat = format;
			this.dateTimeFormatInfo = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
		}

		public DateTime parse( string value_Renamed ){
			return System.Convert.ToDateTime( value_Renamed, this.dateTimeFormatInfo );
		}

		public DateTime parseExact( string value_Renamed )
		{
			return DateTime.ParseExact( value_Renamed, this.dateTimeFormat, this.dateTimeFormatInfo );
		}

		public string format( DateTime dateTime ){
			return dateTime.ToString( this.dateTimeFormat , this.dateTimeFormatInfo );
		}
	}
}
